<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>

</html>
<script>
    var year = prompt("请输入年份");
    var month = prompt("请输入月份");
    // month是字符串类型 需要类型转换
    switch (parseInt(month)) {
        case 1:
        case 3:
        case 5:
        case 7:
        case 8:
        case 10:
        case 12:
            alert("31天");
            bresk;
        case 4:
        case 6:
        case 9:
        case 11:
            alert("30天");
            bresk;
        case 2:
            //判断平年闰年
            if (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) {
                alert("29天");
            } else {
                alert("28天");
            }
    }
</script>